functor MachineMain (S : MACHINE_MAIN_STRUCTS) : MACHINE_MAIN =
struct
  open S
  
  structure Machine = Machine
  structure Cfg = Cfg
  
  structure Machinize = Machinize (structure Machine = Machine
                                   structure Cfg = Cfg)
                                   
  structure ReNumber = ReNumber (structure Machine = Machine)  
  structure LinearScan = LinearScan (structure Machine = Machine)
                             
  val tag = false
                     
  fun trans new =
      let val new = Machinize.trans new
          val _ = if tag 
                  then Machine.Program.toDot (new, "Machine")
                  else ()
          val new = ReNumber.renumber new
          val _ = if tag 
                  then Machine.Program.toDot (new, "MachineRenumber")
                  else ()
          val new = LinearScan.trans new
          val _ = if tag
                  then File.output ("LinearScan.c", Machine.Program.toString new)
                  else ()
      in  new
      end
  
end
